cmake_minimum_required(VERSION 2.8.3)
project(sunray_viobot)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")

find_package(catkin REQUIRED COMPONENTS
  rosmsg
  message_generation  
  message_runtime
  roscpp
  geometry_msgs
  nav_msgs
  sensor_msgs
  std_msgs
  std_srvs
  tf
  tf2_ros
  tf2_eigen
  tf2_geometry_msgs
  visualization_msgs
  actionlib
  actionlib_msgs
)

## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)

################################################
## Declare ROS messages, services and actions ##
################################################

add_action_files(
  DIRECTORY action
  FILES keyFrame_handle.action
)

add_message_files(
  DIRECTORY msg
  FILES
  algo_ctrl.msg
  algo_status.msg
  viobot_ctrl.msg
  image_info.msg
  viobot_state.msg
)


## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  sensor_msgs
  std_msgs
  actionlib_msgs
)

catkin_package(
  INCLUDE_DIRS include
 # LIBRARIES viobot
  CATKIN_DEPENDS message_runtime roscpp rosmsg
)
###########
## Build ##
###########
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)


###############################
##      声明可执行cpp文件     ##
###############################
add_library(viobot lib/viobot.cpp)

add_executable(viobot_node src/viobot_node.cpp)
add_dependencies(viobot_node viobot_gencpp)
target_link_libraries(viobot_node ${catkin_LIBRARIES} viobot)

add_executable(viobot_demo src/viobot_demo.cpp)
add_dependencies(viobot_demo viobot_gencpp)
target_link_libraries(viobot_demo ${catkin_LIBRARIES} viobot)

#############
## Install ##
#############

## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  FILES_MATCHING PATTERN "*.h"
)

## Mark other files for installation (e.g. launch and bag files, etc.)
install(DIRECTORY launch/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
